﻿@using ZBJF.Warranty.WebProvider
@{
    ViewBag.Title = "信息收集项目";
}
@section Header{
    @Scripts.Render("~/bundles/datatable")
    @Styles.Render("~/Content/datatable")
}
<ul class="nav nav-tabs">
    <li class="active"><a href="/InfoCollectItem/">信息收集项目</a></li>
    <li class="Add-R"><a href="/InfoCollectItem/Edit/0">添加信息收集项目</a></li>
</ul>
<form id="searchForm" class="breadcrumb form-search">
    <div>
        <label>信息收集项目分类：</label>
        @Html.DropDownList("InfoCollectCategoryID", ConvertToSelector.Instance.InfoCollectItemCategoryToSelectList())
        <label>关键词：</label>
        <input id="Keyword" name="Keyword" class="input-medium" placeholder="请输入搜索关键词" type="text" value="" maxlength="50"/>
        <input class="btn form-reset" type="button" value="重置">
        <input id="btnSubmit" class="btn btn-primary Search-R" type="button" value="查询" onclick="search();">
    </div>
</form>
<div class="table-responsive dataTables_wrapper">
    <table id="dataTable" class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th width="20">序号</th>
                <th width="100">信息收集项目名称</th>
                <th width="100">所属分类名称</th>
                <th width="100">操作</th>
            </tr>
        </thead>
    </table>
</div>
@section scripts{
    @Scripts.Render("~/Bundles/Chosen")
    @Styles.Render("~/Content/Chosen")
    <script type="text/javascript">
        $(function () {
            $("#InfoCollectCategoryID").chosen();
            var objTable = $("#dataTable")
                .dataTable({
                    fnDrawCallback: function () {
                        ControlPermissionOperate();
                    },
                    "sAjaxSource": "/InfoCollectItem",
                    aoColumns: [
                        {
                            "mData": null, "fnRender": function (nRow) {
                                return nRow.iDataRow + 1;
                            }
                        },
                        {
                            "mData": null, "fnRender": function (nRow) {
                                return "<a class='Edit-R' onclick='show' href='/InfoCollectItem/Edit/" + nRow.aData.ID + "' title='edit'>" + nRow.aData.InfoCollectItemName + "</a>";
                            }
                        },
                        { "mData": "InfoCollectCategoryName" },
                        { "mData": null }
                    ],
                    "fnRowCallback": function (nRow, aData, iDisplayIndex) {
                        var html = "<a class='Edit-R' href='/InfoCollectItem/Edit/" + aData.ID + "' title='edit'><i class='icon-edit'></i></a>";
                        html += "<a class='Edit-R padding-l-5' href=\"javascript:DeleteObj('" + aData.ID + "','/InfoCollectItem/Delete','dataTable')\" title='删除'><i class='icon-trash red'></a>";
                        $('td:eq(3)', nRow).html(html);
                    }
                });
        });
        function search() {
            /*给查询对象赋值*/
            queryParamList.Keyword = ($("#Keyword").val()).trim();
            queryParamList.InfoCollectCategoryID = ($("#InfoCollectCategoryID").val()).trim();
            $("#dataTable").dataTable().fnDraw();
        }

    </script>
}

